/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Pablo
 */
@Entity
@Table(name = "nivelesidiomastrad")
@NamedQueries({
    @NamedQuery(name = "Nivelesidiomastrad.findAll", query = "SELECT n FROM Nivelesidiomastrad n")})
public class Nivelesidiomastrad implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_nivel_trad")
    private Integer idNivelTrad;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "idioma_lectura")
    private String idiomaLectura;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "nivel")
    private String nivel;
    @JoinColumn(name = "id_nivel_idioma", referencedColumnName = "id_nivel_idioma")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Nivelesidiomas idNivelIdioma;

    public Nivelesidiomastrad() {
    }

    public Nivelesidiomastrad(Integer idNivelTrad) {
        this.idNivelTrad = idNivelTrad;
    }

    public Nivelesidiomastrad(Integer idNivelTrad, String idiomaLectura, String nivel) {
        this.idNivelTrad = idNivelTrad;
        this.idiomaLectura = idiomaLectura;
        this.nivel = nivel;
    }

    public Integer getIdNivelTrad() {
        return idNivelTrad;
    }

    public void setIdNivelTrad(Integer idNivelTrad) {
        this.idNivelTrad = idNivelTrad;
    }

    public String getIdiomaLectura() {
        return idiomaLectura;
    }

    public void setIdiomaLectura(String idiomaLectura) {
        this.idiomaLectura = idiomaLectura;
    }

    public String getNivel() {
        return nivel;
    }

    public void setNivel(String nivel) {
        this.nivel = nivel;
    }

    public Nivelesidiomas getIdNivelIdioma() {
        return idNivelIdioma;
    }

    public void setIdNivelIdioma(Nivelesidiomas idNivelIdioma) {
        this.idNivelIdioma = idNivelIdioma;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idNivelTrad != null ? idNivelTrad.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nivelesidiomastrad)) {
            return false;
        }
        Nivelesidiomastrad other = (Nivelesidiomastrad) object;
        if ((this.idNivelTrad == null && other.idNivelTrad != null) || (this.idNivelTrad != null && !this.idNivelTrad.equals(other.idNivelTrad))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Nivelesidiomastrad[ idNivelTrad=" + idNivelTrad + " ]";
    }
    
}
